package com.sunfeng;

import java.nio.CharBuffer;

/**
 * @description:
 * @author: 孙 峰
 * @time: 2020/11/5 20:44
 */
public class Test21 {
    public static void main(String[] args) {
        char[] chars = new char[]{'a', 'b', 'c', 'd','e','f','g','h','i'};
        CharBuffer charBuffer = CharBuffer.wrap(chars);
        System.out.println("A capacity()="+charBuffer.capacity());
        System.out.println("A limit()="+charBuffer.limit());


        System.out.println("B capacity()="+charBuffer.capacity());
        System.out.println("B limit()="+charBuffer.limit());
        charBuffer.put(0,'1');//0
        charBuffer.put(1,'2');//0
        charBuffer.put(2,'3');//0
        charBuffer.put(3,'4');//0
        charBuffer.limit(4);
        System.out.println(charBuffer.toString());
    }
}
